<?php
mysqli_set_charset(Globals::$db, "utf8");
$query = "SELECT `id` , `login` , `onoma` , `energos` , `sira` FROM `komotis`
	 WHERE `energos` = 1 ORDER BY `sira` ASC";
$result = mysqli_query(Globals::$db, $query);
$sira = 0;
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
	
		echo "komotes[" . $sira . "] = new komotis(" .
			$row['id'] . "," .
			"'" . $row['login'] . "', " .
			"'" . $row['onoma'] . "', " .
			$row['energos'] . ", " .
			$sira . "); \n";
		
	$sira++;
}
echo "\n";
mysqli_free_result($result);
?>
